Chris Pollett > Old Classes >
CS157a

( Print View )

Student Corner:
  [Grades Sec3]
  [Grades Sec4]

  [Submit Sec3]
  [Submit Sec4]

  [Email List Sec3]
  [Email List Sec4]

  [
Lecture Notes]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












CS157a Fall 2005Practice Midterm 2

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes three times. Second and third time try to see how huch you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) The midterm will be in class Nov 9. (b) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (c) You should bring photo ID. (d) There will be more than one version of the test. Each version will be of comparable difficulty. (e) If your cell-phone or beeper goes off you will be excused from the test at that point and graded on what you have done till your excusal. (f) One problem (less typos) on the actual test will be from the practice test.

[Student Generated Solutions-PDF]

1. Consider the following two tables:

R(A,B,C)
=====
a b c
a b d
b e f

and

S(C,D)
c 1 
f 1 
g 2

Write a relational algebra expression to compute the natural join of these two tables and then project out columns A, D. Show what the result of doing this on the above tables would be.

2. Compute the right outer join and outer union of table R and S above.

3. Give a tuple calculus expression which prints out all the project Names of PROJECTs that have at least one EMPLOYEE who works on at least two other projects.

4. Redo (3) in the domain calculus.

5. Draw an ER Diagram consisting of an entity E and a weak entity W. E should have at least one multivalued attribute. W should be owned by E and you should indicate an attribute as a partial key. Then step-by-step using the algorithm from class show how to convert this ER diagram to the relational model.

6. Give an example of how to use each of the following SQL DDL commands, CREATE SCHEMA, CREATE TABLE, CREATE TYPE, CREATE ASSERTION. Explain in English waht each does.

7. Explain what a referentially triggered action is and give example SQL code to control such actions.

8. Rewrite the answer of problem (3) in SQL order the results alphabetically in descending order.

9. Write an SQL query which prints out the name, manager's name, and employee count of all departments having more than 10 employees.

10. Give the SQLJ code to make a connection to a database, then read each row from the table R(A,B) and print the results to the screen.